package com.ruoyi.flow.flow.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.flow.activiti.domain.editor.model.Model;
import com.ruoyi.flow.common.utils.DateUtils;
import org.springframework.data.annotation.Transient;

import java.io.File;
import java.util.Date;

/**
 * @Author: wtian
 * @Description:
 * @Date: Created in 10:42 2018/8/13
 * @Version: 1.0
 */
public class ModelBean {
    private String fileName;
    private File file;
    private String modelKey;
    private String modelName;
    private String modelId;
    private String createUser;
    @Transient
    @JsonIgnore
    private Date createTime;
    private String createTimeStr;
    private byte[] thumbnail;
    private String deployId;
    private String definitionId;
    private String definitionKey;
    private int version;

    public ModelBean(File bpmnFile, Model model) {
        this.fileName = bpmnFile.getName();
        this.file = bpmnFile;
        this.modelKey = model.getKey();
        this.modelName = model.getName();
        this.modelId = model.getId();
        this.createUser = model.getCreatedBy();
        this.createTime = model.getCreated();
        this.createTimeStr = DateUtils.format(this.createTime, "yyyy-MM-dd HH:mm:ss");
        this.thumbnail = model.getThumbnail();
        this.version = model.getVersion();
    }

    public ModelBean(Model model) {
        this.modelId = model.getId();
        this.modelKey = model.getKey();
        this.modelName = model.getName();
        this.createUser = model.getCreatedBy();
        this.createTime = model.getCreated();
        this.createTimeStr = DateUtils.format(this.createTime, "yyyy-MM-dd HH:mm:ss");
        this.thumbnail = model.getThumbnail();
        this.version = model.getVersion();

    }

    public ModelBean() {
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public String getModelKey() {
        return modelKey;
    }

    public void setModelKey(String modelKey) {
        this.modelKey = modelKey;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public String getModelId() {
        return modelId;
    }

    public void setModelId(String modelId) {
        this.modelId = modelId;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreateTimeStr() {
        return createTimeStr;
    }

    public void setCreateTimeStr(String createTimeStr) {
        this.createTimeStr = createTimeStr;
    }

    public byte[] getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(byte[] thumbnail) {
        this.thumbnail = thumbnail;
    }

    public String getDeployId() {
        return deployId;
    }

    public void setDeployId(String deployId) {
        this.deployId = deployId;
    }

    public String getDefinitionId() {
        return definitionId;
    }

    public void setDefinitionId(String definitionId) {
        this.definitionId = definitionId;
    }

    public String getDefinitionKey() {
        return definitionKey;
    }

    public void setDefinitionKey(String definitionKey) {
        this.definitionKey = definitionKey;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }
}
